const lodash = require('lodash');
const view = {

  init(tablename) {
    let camelCaseTableName = lodash.camelCase(tablename);
    let camelCaseTableNameFirst = lodash.upperFirst(camelCaseTableName);
    let modelName = camelCaseTableName + "Model";
    let api = `
import APIFunction from './APIFunction';
const api = {
    queryDataList: 'POST /${tablename}/querylist',
    ${camelCaseTableName}Add: 'POST /${tablename}/add',
    ${camelCaseTableName}Edit: 'POST /${tablename}/edit',
    ${camelCaseTableName}Del: 'POST /${tablename}/delete',
    query${camelCaseTableNameFirst}ById: 'POST /${tablename}/querybyid',
}
const API = APIFunction(api);

export default API;`;
    return api;
  }

}

module.exports = view;